Skip to content

feat: harden premium payment date progression logic#415

Merged
Baskarayelu merged 2 commits intoRemitwise-Org:mainfrom
Mosas2000:feature/insurance-premium-date-drift-hardening
Mar 28, 2026
Merged

feat: harden premium payment date progression logic#415
Baskarayelu merged 2 commits intoRemitwise-Org:mainfrom
Mosas2000:feature/insurance-premium-date-drift-hardening

Conversation

@Mosas2000
Copy link
Copy Markdown
Contributor

Implement deterministic next_payment_date updates to prevent schedule drift:

  • Add PREMIUM_INTERVAL_SECONDS constant (30 days) for consistent interval usage
  • Modify pay_premium to advance from previous due date, not current timestamp
  • Handle late payments by advancing until next_due is in the future
  • Prevent schedule manipulation through early or late payment timing

The new logic ensures:

  • Early payments don't shift the schedule forward
  • Late payments don't double-cover periods
  • Payment schedules remain predictable regardless of payment timing

Test coverage includes:

  • Early payment scenarios (5-15 days early)
  • On-time payment boundary cases
  • Late payment single/multiple period scenarios
  • Mixed early/late payment sequences over 12 months
  • Boundary condition at exactly next_due timestamp

Resolves: premium payment date drift issue

Closes #278

Mosas2000 and others added 2 commits March 27, 2026 09:26
Implement deterministic next_payment_date updates to prevent schedule drift:

- Add PREMIUM_INTERVAL_SECONDS constant (30 days) for consistent interval usage
- Modify pay_premium to advance from previous due date, not current timestamp
- Handle late payments by advancing until next_due is in the future
- Prevent schedule manipulation through early or late payment timing

The new logic ensures:
- Early payments don't shift the schedule forward
- Late payments don't double-cover periods
- Payment schedules remain predictable regardless of payment timing

Test coverage includes:
- Early payment scenarios (5-15 days early)
- On-time payment boundary cases
- Late payment single/multiple period scenarios
- Mixed early/late payment sequences over 12 months
- Boundary condition at exactly next_due timestamp

Resolves: premium payment date drift issue
@Baskarayelu Baskarayelu merged commit 072a3d0 into Remitwise-Org:main Mar 28, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Harden premium payment date progression against drift

2 participants